<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.min.js"></script>
</head>
<body>
<div id="app">
    <ul>
        <template v-for="book in filterBooks">
            <li>书名：{{book.name}}</li>
            <li>作者：{{book.author}}</li>
            <br>
        </template>
    </ul>
</div>
</body>
<script>
    var yyf = new Vue({
        el: "#app",
        data: {
            books: [{
                name: '《《VUE.JS实战》》',
                author: '小明'
            }, {
                name: '《《JAVASCRIPT实战》》',
                author: '小杨'
            }, {
                name: '《《JAVASCRIPT高级程序设计》》',
                author: '小张'
            }]
        },
        computed: {
            filterBooks: function () {
                return this.books.sort(function (s1, s2) {
                    return s1.name.length < s2.name.length;
                })
            }
        }
    });
    /* yyf.books = yyf.books.filter(function (item) {
     return item.name.match(/JAVASCRIPT/);
     })
     yyf.books[1] = {
     name: '瓜皮',
     author: '小张'
     }*/
</script>
</html>